# -*- coding: utf-8 -*-
# @Time    : 2019/11/7 15:39
# @Author  : xiao
import os
import sys

from basic.data import global_var
from basic.utils.Email import sendEmail
from basic.UIParent import UIParent
from basic.utils.path import Path
from basic.utils.runnerInit import CaseRunner
from test.cases.ann import growValue
from test.cases.ann.annApplication.corona import CoronaCase
from test.cases.ann.annApplication.credit_medical import CreditMedicalCase
from test.cases.ann.annApplication.doctorOnline import DoctorOnlineCase
from test.cases.ann.annApplication.healthClass import HealthClassCase
from test.cases.ann.card import CardCase
from test.cases.ann.collectionApp import collectionAppCase
from test.cases.ann.coupon import CouponCase
from test.cases.ann.dataSecretary import DataSecretaryCase
from test.cases.ann.digital import DigitalCase
from test.cases.ann.finance import FinanceCase
from test.cases.ann.headlines import HeadlinesCase
from test.cases.ann.message import MessageCase
from test.cases.ann.oclife import OclifeCase
from test.cases.ann.personalCredit import PersonalCreditCase
from test.cases.ann.share import ShareCase
from test.cases.ann.trends import TrendsCase
from test.cases.ann.tsyh import TsyhCase
from test.cases.ann.weather import WeatherCase
from test.cases.ann.ycfl import YcflCase
from test.cases.ann.zhengwu import BsCase
from test.cases.ann.index import IndexCase
from test.cases.ann.accumulationFund import AccumulationFundCase
from test.cases.ann.cancellating import CancellatingCase
from test.cases.ann.search import SearchCase
from BeautifulReport import BeautifulReport as bf
from test.cases.ann.help import HelpCase
from test.cases.ann.tax import TaxCase
from test.cases.ann.ws import WsCase

current_directory = os.path.dirname(os.path.abspath(__file__))
root_path = os.path.abspath(os.path.dirname(current_directory) + os.path.sep + ".")
sys.path.append(root_path)

if __name__ == '__main__':

   #方式一
   # suite=unittest.TestSuite()
   # suite.addTest(pocesuite("test_two"))
   # suite.addTest(pocesuite("test_first"))
   # suite.addTest(pocesuiteDome("test_first"))
   # suite.addTest(pocesuiteDome("test_two"))
   # unittest.TextTestRunner(verbosity=2).run(suite)

   #方式二
   # suite1=unittest.TestSuite(unittest.makeSuite(pocesuite))
   # suite2=unittest.TestSuite(unittest.makeSuite(pocesuiteDome))
   # suite=unittest.TestSuite()
   # suite.addTest(suite1)
   # suite.addTest(suite2)
   # unittest.TextTestRunner(verbosity=2).run(suite)

   # # 方式三
   # suite=unittest.TestSuite(unittest.findTestCases("test"))
   # unittest.TextTestRunner(verbosity=2).run(suite)

   #方式四
   # classNameList=[pocesuiteDome]
   # suite=UIParent.runCases(classNameList)
   # unittest.TextTestRunner(verbosity=2).run(suite)
   #

   #报告
   # classNameList = [ bsCase, growValueCase, dataSecretaryCase]
   classNameList = [WsCase]
   suite = CaseRunner.runCases(classNameList)
   run = bf(suite)  # 实例化BeautifulReport模块
   run.startTestRun()
   run.report(filename='test',report_dir=Path.getProjectPath()+"/res/report", description='UI自动化测试用例')
   #caseResult的type设置成1是不上传结果，sendEmail的isSend设置成1时不发送邮件
   sendEmail("UI自动化测试", CaseRunner.caseResult(run, 1), 1)
